jQuery(function() {
	isShowToolTip = false; // variable is in datecontroller
	var unavailableDates = ["25-8-2013", "24-8-2013", "29-8-2013"];
	var mindate = "-" + new Date().getMonth() + "m -" + Number(new Date().getDate() - 1) + "d";
	// Setting Start of Current Year
	var maxdate = "+2y +" + Number(11 - new Date().getMonth()) + "m +" + Number(30 - new Date().getDate()) + "d";
	// Setting Start of Current Year
	console.log("in unique common", mindate, maxdate);
	jQuery(".datepicker").datepicker("option", "dateFormat", "dd/mm/yy");
	jQuery(".datepicker").datepicker("option", "minDate", mindate);
	jQuery(".datepicker").datepicker("option", "maxDate", maxdate);
	jQuery(".datepicker").datepicker('option', 'beforeShowDay', highlightDays);

	jQuery(".datepicker_ayp").datepicker({
		changeMonth : true,
		changeYear : true,
		dateFormat : "dd/mm/yy",
		minDate : mindate,
		maxDate : maxdate,
		beforeShowDay : highlightDays,
		prevText:'Prev Month',
		nextText:'Next Month'
	});


	jQuery("#dialog-alert").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});

	jQuery(".closeAlert").click(function() {
		jQuery("#dialog-alert").dialog("close");
	});

	/*
	jQuery("#dialog-confirm-save").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});
	
	jQuery("#dialog-error-alert").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});
	
	jQuery("#dialog-validationError-alert").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});*/
	

	/*	jQuery(".datepicker_ayp_start").datepicker({
	 changeMonth : true,
	 changeYear : true,
	 dateFormat : "dd/mm/yy",
	 minDate : mindate,
	 maxDate : maxdate
	 //	beforeShowDay : highlightDays
	 });

	 jQuery(".datepicker_ayp_end").datepicker({
	 changeMonth : true,
	 changeYear : true,
	 dateFormat : "dd/mm/yy",
	 minDate : mindate,
	 maxDate : maxdate
	 //beforeShowDay : highlightDays
	 });
	 */
	/*	function highlightDays(date) {
	 var rtnVal = true;
	 var rtnClass = "";
	 var toolTip = "";

	 //dmy = date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear();
	 ko.utils.arrayForEach(myAcademicYearModel.holidays(), function(item) {
	 var itemEvent = item;
	 console.log("item Holiday:", itemEvent.startDate());
	 var strArr1 = itemEvent.startDate().split("/");
	 var strArr2 = itemEvent.endDate().split("/");
	 // years, months, date
	 var startDate = new Date(strArr1[2], Number(strArr1[1] - 1), strArr1[0]);
	 var endDate = new Date(strArr2[2], Number(strArr2[1] - 1), strArr2[0]);

	 if (startDate <= date && date <= endDate) {
	 rtnVal = false;
	 rtnClass = "create_ayp_holiday";
	 toolTip = itemEvent.title();

	 //break
	 //return [false, "nonAvailable", "Unavailable"];
	 }
	 });

	 ko.utils.arrayForEach(myAcademicYearModel.eventData(), function(item) {
	 var itemEvent = item;

	 if (ko.isObservable(itemEvent.startDate)) {
	 console.log("observable item", itemEvent)
	 var strArr1 = itemEvent.startDate().split("/");
	 var strArr2 = itemEvent.endDate().split("/");

	 } else {
	 console.log("Non observable item", itemEvent)
	 var strArr1 = itemEvent.startDate.split("/");
	 var strArr2 = itemEvent.endDate.split("/");
	 }
	 // years, months, date
	 var startDate = new Date(strArr1[2], Number(strArr1[1] - 1), strArr1[0]);
	 var endDate = new Date(strArr2[2], Number(strArr2[1] - 1), strArr2[0]);

	 if (startDate <= date && date <= endDate) {
	 //rtnVal = false;
	 rtnClass = "create_ayp_event";
	 if (ko.isObservable(itemEvent.startDate)) {
	 toolTip = itemEvent.title();

	 } else {
	 toolTip = itemEvent.title;
	 }
	 }
	 });

	 //if (rtnVal) {
	 //	return [rtnVal, ""];
	 //} else {

	 return [rtnVal, rtnClass, toolTip];
	 //}
	 }*/

});
